#include "tableitem.h"
#include "ui_tableitem.h"
#include <QDebug>


tableitem::tableitem(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::tableitem)
{
    ui->setupUi(this);
}

tableitem::~tableitem()
{
    delete ui;
}

///传入所有手机信息
/// PhoneInfo:手机信息列表
/// item：第几项
void tableitem::updateItemInfo(const  QVector<QString> PhoneInfo,char item)
{


      qDebug() << PhoneInfo;

      ui->pb_modelnumber->setText(PhoneInfo.at(0+item*7));
      ui->lb_price->setText(PhoneInfo.at(1+item*7));
      ui->lb_color->setText(PhoneInfo.at(2+item*7));
      ui->lb_salevolume->setText(PhoneInfo.at(3+item*7));
      QString PictureName = "../Phone_platform/sources/picture" + PhoneInfo.at(4+item*7) + "001.jpg";
      ui->lb_StoreName->setText(PhoneInfo.at(6+item*7));
      QImage img(PictureName);
      ui->lb_picture->setPixmap(QPixmap::fromImage(img));

}


///发送请求，获取详情页
void tableitem::on_pb_modelnumber_clicked()
{
    qDebug() << "emit :" << ui->pb_modelnumber->text();
    emit SignalGetDetils(ui->pb_modelnumber->text());
}

///// 联系客服按钮槽函数
void tableitem::on_pb_CustomerService_clicked()
{
    emit SignalChatWithStore();
}
